import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/layout'

Vue.use(VueRouter)
//公共路由
export const constantRoutes = [
    {
        path: '',
        component: Layout,
        redirect: 'index',
        children: [
            {
                path: 'index',
                component: () => import('@/views/index'),
                name: 'Index',
                meta: { title: '首页', icon: 'dashboard', affix: true }
            }
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/Login'),
        // hidden: true
    },
    {
        path: '/404',
        component: () => import('@/views/404'),
        hidden: true
    },

]

export const dynamicRoutes =[
    {
        path:'/grade',
        component:Layout,
        children:[
            {
                path:'/student-info',
                component:()=>import('@/views/grade/student/StudentInfo'),
                meta :{title:'学生信息' , icon: 'el-icon-s-check'}
            },
            {
                path:'/class-manage',
                component:()=>import('@/views/grade/class/ClassManage'),
                meta :{title:'班级信息' , icon: 'el-icon-s-check'}
            },
            {
                path:'/transfer-to-major',
                component:()=>import('@/views/grade/transfer/TransferToMajor'),
                meta :{title:'转专业信息' , icon: 'el-icon-s-check'}
            }
        ]
    },
    {
        path:'/discipline',
        component:Layout,
        children:[
            {
                path:'/departMent-info',
                component:()=>import('@/views/discipline/depart/DepartMentInfo'),
                meta :{title:'学部信息' , icon: 'el-icon-s-check'}
            }
        ]
    },
    {
        path:'/teacher',
        component:Layout,
        children:[
            {
                path:'/teacher-manage',
                component:()=>import('@/views/teacher/TeacherManage'),
                meta :{title:'学生信息' , icon: 'el-icon-s-check'}
            }
        ]
    },
    {
        path: '/404',
        component: () => import('@/views/404'),
        name: 'error',
        meta: {title: '页面没找到'}
    }



]

export default new VueRouter({
    mode: 'history', // 去掉url中的#
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
})
